(function(global) {
	var require, define;
	var modules = {};
	function build(module) {
		var factory = module.factory;
		module.exports = {};
		delete module.factory;
		factory(require, module.exports, module);
		return module.exports;
	}
	require = function(id) {
		if (!modules[id]) {
			throw 'module ' + id + 'not found';
		}
		return modules[id].factory ? build(modules[id]) : modules[id].exports;
	};
	define = function(id, factory) {
		if (modules[id]) {
			throw 'module ' + id + ' already defined';
		}
		modules[id] = {id:id, factory:factory};
	};
	define.remove = function(id) {
		delete modules[id];
	};
	global.require = require;
	global.define = define;
})(this);
var define = this.define;
var require = this.require;

define('utils', function(require, exports, module) {
	var utils = exports;
	utils.isArray = function(a) {
		return Object.prototype.toString.call(a) == '[object Array]';
	};
	utils.log = function(msg) {
		if(console && console.log) console.log(msg);
	};
	module.exports = utils;
});

define('view', function(require, exports, module) {
	var utils = require('utils');
	var views = {
		showWebView: function() {
			 utils.log('Show WebView...');
		},
		hideWebView: function() {
			 utils.log('Hide WebView...');
		}
	};
	module.exports = views;
});

var cnBlogsView = require('view');
console.log(cnBlogsView);
cnBlogsView.showWebView();

/*
define.remove('cnblogs/view');
var cnBlogsView1 = require('cnblogs/view');
cnBlogsView1.showWebView();
*/
